// index.js
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/dashboard',
    },
    {
      path: '/',
      name: 'Layout',
      component: () => import('@/views/layout/index.vue'),
      children: [
        {
          path: '/dashboard',
          name: 'Home',
          component: () => import('@/views/home/index.vue'),
          meta: {
            title: '首页',
          },
        },
        {
          path: '/blog',
          component: () => import('@/views/layout/main.vue'), // 使用空的布局组件
          children: [
            {
              path: 'article',
              name: 'Article',
              component: () => import('@/views/article/index.vue'),
              meta: {
                title: '文章管理',
                icon: 'list',
              },
            },
            {
              path: 'category',
              name: 'Category',
              component: () => import('@/views/category/index.vue'),
              meta: {
                title: '分类管理',
                icon: 'el-icon-s-order',
              },
            },
            {
              path: 'label',
              name: 'Label',
              component: () => import('@/views/label/index.vue'),
              meta: {
                title: '标签管理',
                icon: 'el-icon-collection-tag',
              },
            },
          ],
        },
        // 可以添加其他模块的路由配置
      ],
    },
  ],
})

export default router
